Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(abstract-eth): move txBuilder to abstract-eth #4030

Merged
merged 8 commits into from
Nov 2, 2023

Conversation

gianchandania
Copy link
Contributor

@gianchandania gianchandania commented Oct 31, 2023

The main purpose of this PR is to move TransactionBuilder and other related classes from sdk-coin-eth to abstract-eth module. This is being done as part of refactoring effort to make it easy to add new eth-like chains.

This PR has 8 commits

  1. This commit moves the transaction builder from sdk-coin-eth to abstract-eth module. As part of this commit we are avoiding to make any imports from sdk-coin-eth in abstract-eth module and instead moving all the required classes and methods in abstract-eth module. This commit also adds a new class AbstractEthLikeNewCoins. This class will be inherited by all the eth-like coins like polygon, arbitrum, optimism, bsc

  2. This commit makes changes in sdk-coin-polygon related to txBuilder refactor.

  3. This commit
    makes changes in sdk-coin-arbeth related to txBuilder refactor. It adds getContractData method for arbeth. It also adds bytecode and abi for the ArbethWalletSimple contract

  4. This commit
    makes changes in sdk-coin-opeth related to txBuilder refactor. It adds getContractData method for arbeth. It also adds bytecode and abi for the OpethWalletSimple contract

  5. This commit makes changes in sdk-coin-ethw related to txBuilder refactor.

  6. This commit fixes the issue related to bignumber package versions

  7. This commit deletes the MPC related classes as we will use AbstractEthLikeNewCoins class for multisig and MPC related methods for all the upcoming EthLike coins

  8. This commit exports Ethereum Transactionbuilder and Transfer builder as this was the behavior before this change

WIN-1021
TICKET: WIN-1021

Copy link

socket-security bot commented Oct 31, 2023

No top level dependency changes detected. Learn more about Socket for GitHub ↗︎

@gianchandania gianchandania force-pushed the WIN-1021-move-txbuilder-abstracteth branch 7 times, most recently from 34d1c76 to baec169 Compare October 31, 2023 19:28
protected getTransactionBuilder(): EthTransactionBuilder {
return new EthTransactionBuilder(coins.get(this.getBaseChain()));
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Modified this method because TransactionBuilder in abstract-eth is an abstract class and we can't instantiate the abstract class

@gianchandania gianchandania force-pushed the WIN-1021-move-txbuilder-abstracteth branch 4 times, most recently from c74f685 to 8548afb Compare November 1, 2023 06:51
@gianchandania gianchandania marked this pull request as ready for review November 1, 2023 06:53
@gianchandania gianchandania requested review from a team as code owners November 1, 2023 06:53
Copy link
Contributor

@rushilbg rushilbg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The commits linked in the description are invalid.

@gianchandania
Copy link
Contributor Author

The commits linked in the description are invalid.

sorry for that, have updated the links in the description

Copy link
Contributor

@sachushaji sachushaji left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice Job!!! ❤️ ❤️ , This will speed up EVM based onboarding onto SDK for future coins!! , just have some small comments

@@ -1,4 +1,4 @@
import { TransactionBuilder } from '../../src';
import { TransactionBuilder } from '../../src/lib/transactionBuilder';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Think we need to keep the import as is?

Copy link
Contributor Author

@gianchandania gianchandania Nov 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was by mistake, ideally the previous import is working fine, will address this in a follow up

const resultEncodedParameters = EthereumAbi.rawEncode(walletSimpleConstructor, params)
.toString('hex')
.replace('0x', '');
return walletSimpleByteCode + resultEncodedParameters;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May be we can add it to a property / method in the class to get this value which can help us abstract it further and avoid the need of redefining it each time

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will address this in a follow up PR as part of this ticket WIN-1012

@@ -23,7 +23,6 @@ describe('Optimism', function () {
opeth.getFamily().should.equal('opeth');
opeth.getFullName().should.equal('Optimism Ethereum');
opeth.getBaseFactor().should.equal(1e18);
opeth.supportsTss().should.equal(true);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💔

Copy link
Contributor

@zahin-mohammad zahin-mohammad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why I am needed as a review for this, but we are likely missing some code owner rules.

WIN-1021

BREAKING CHANGE: getTransactionBuilder method is removed from EthLikeToken
class in abstract-eth module because TransactionBuilder in the
abstract-eth module is abstract class and hence cannot be instantiated. Hence the implementation of TransactionBuilder can
be added to the class that will inherit EthLikeToken class

TransactionPrebuild from new class AbstractEthLikeNewCoins is being
exported now instead of TransactionPrebuild from AbstractEthLikeCoin
class as the TransactionPrebuild from AbstractEthLikeNewCoins also has
support for hop transactions, batch transactions, etc

TICKET: WIN-1021
WIN-1021

BREAKING CHANGE: AbstractEthLikeMPCCoin and EthLikeMPCToken classes are removed as we have instead added
a new class AbstractEthLikeNewCoins which will be having both multisig
and MPC related methods

TICKET: WIN-1021
@gianchandania gianchandania force-pushed the WIN-1021-move-txbuilder-abstracteth branch from 8548afb to 286ccfd Compare November 2, 2023 03:41
@gianchandania gianchandania merged commit 20e4cf4 into master Nov 2, 2023
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants